
<script type="text/javascript" src="__STATIC__/admin/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/ueditor/ueditor.all.min.js"></script>

<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" name="title" value='{$vo.title|default=""}' required="required" title="请输入名称" placeholder="请输入名称" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用法用量</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入用法用量" title="请输入用法用量" class="layui-textarea" name="usage">{$vo.usage|default=""}</textarea>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">图片</label>
        <div class='layui-input-block'>
            <img data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{$vo.thumb|default='static/admin/theme/default/img/image.png'}"/>
            <input type="hidden" name="thumb" onchange="$(this).prev('img').attr('src', this.value)" value="{$vo.thumb|default=''}" class="layui-input">
            <a class="btn btn-link" data-file="one" data-type="png,jpg,jpeg" data-field="thumb">上传图片</a>
            <!-- <p>建议上传图片的尺寸为： (px)。</p> -->
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">地区</label>
        <div class="layui-input-block" id="aid">
        </div>
        <script>
            var aid = xmSelect.render({
                el: '#aid', 
                name: 'aid',
                layVerify: 'required',
                layVerType: 'msg',
                showCount: 10,
                height: '500px',
                autoRow: true,
                toolbar: {
                    show: true,
                },
                tree: {
                    //是否显示树状结构
                    show: true,
                    //是否展示三角图标
                    showFolderIcon: true,
                    //是否显示虚线
                    showLine: false,
                    //间距
                    indent: 20,
                    //默认展开节点的数组, 为 true 时, 展开所有节点
                    expandedKeys: [], 
                    //是否严格遵守父子模式
                    strict: false,
                    //是否开启极简模式
                    simple: false,
                    //点击节点是否展开
                    clickExpand: true,
                    //点击节点是否选中
                    clickCheck: true,
                },
                filterable: true,
                tips:'请选择地区',
                searchTips: '请选择地区',
                empty:'请选择地区',
                emptyTips: '请选择地区',
                data: {:json_encode($newareas)}
            })
        </script>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">民族</label>
        <div class="layui-input-block" id="nid">
        </div>
        <script>
            var nid = xmSelect.render({
                el: '#nid', 
                name: 'nid',
                layVerify: 'required',
                layVerType: 'msg',
                showCount: 10,
                height: '500px',
                autoRow: true,
                toolbar: {
                    show: true,
                },
                filterable: true,
                tips:'请选择民族',
                searchTips: '请选择民族',
                empty:'请选择民族',
                emptyTips: '请选择民族',
                data: {:json_encode($newnations)}
            })
        </script>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">疾病</label>
        <div class="layui-input-block" id="did">
        </div>
        <script>
            var did = xmSelect.render({
                el: '#did', 
                name: 'did',
                layVerify: 'required',
                layVerType: 'msg',
                showCount: 10,
                height: '500px',
                autoRow: true,
                toolbar: {
                    show: true,
                },
                filterable: true,
                tips:'请选择疾病',
                searchTips: '请选择疾病',
                empty:'请选择疾病',
                emptyTips: '请选择疾病',
                data: {:json_encode($newdiseases)}
            })
        </script>
    </div>
    
    <div class="layui-form-item">
        <label class="layui-form-label">详情</label>
        <div class="layui-input-block" style="z-index:998;">
            <script id="content" name="content" type="text/plain">
                
            </script>
        </div>
    </div>
    
    <div class="layui-form-item">
        <label class="layui-form-label">访问权限</label>
        <div class="layui-input-block">
            {volist name="rlist" id="item" key="i"}
            <input type="checkbox" {if condition="$vo['readgroup'] && in_array($item['id'],$vo['readgroup'])"}checked{/if} name="readgroup[{$i}]" value="{$item.id}" title="{$item.title}">
            {/volist}
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        <input type="hidden" id="v-content" value='{$vo.content|default=""}'>
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>

<script>window.form.render();</script>

<script type="text/javascript">

    //详情
    var ue1 = UE.getEditor('content');
    ue1.ready(function() {
        ue1.setHeight(200);
        var cont = $("#v-content").val();
        // alert(cont);return false;
        ue1.setContent(cont);
    });
</script>
